define(function (require,exports,module) {
    var VueStore = require("charity/js/store/index")
        // ,FastClick = require("js/config/faskclick")
        ,Router = require("charity/js/router/router")
        ,store = new Vuex.Store(VueStore);
    if ('addEventListener' in document) {
        document.addEventListener('DOMContentLoaded', function() {
            FastClick.attach(document.body);
        }, false);
    }
    var router = new VueRouter({
        // mode: 'history',
        routes:Router.router,
        scrollBehavior:function(to, from, savedPosition) {
            if (savedPosition) {
                return savedPosition
            } else {
                return { x: 0, y: 0 }
            }
        }
    });
    // 页面刷新时，重新赋值
    if (window.localStorage.getItem('login')) {
        store.commit('LOGIN',JSON.parse(window.localStorage.getItem('login')))
    }
    // 跳转页面之前判断是否要登录
    router.beforeEach(function(to, from, next){
        if(to.meta.mustLogin){
            store.state.login.account?next():next({path: '/login', query: {redirect: to.fullPath}});
        }else{
            next()
        }
    })

    var app = new Vue({
        el:'#app',
        name: 'vm',
        router:router,
        store:store,
        created:function(){
        },
        components:{
            //注册组件!
        }
    })


});